package com.youchu.pattern.design.behavioral.chain.handler;

import com.youchu.pattern.design.behavioral.chain.entity.User;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * 具体处理器 - 验证用户名
 */
@Component
@Order(100)
public class UserNameRegisterHandler extends AbstractRegisterHandler {
    public void handleRequest(User user) {
        if (user.getUserName() == null || user.getUserName().isEmpty()) {
            throw new RuntimeException("用户名不能为空");
        }
        next.handleRequest(user);
    }
}